package lxs.swift.verify.getters;

import java.util.Collection;
import java.util.function.Predicate;


public interface CollectGet<T, R> extends Get<T, Collection<R>> {
    default Predicate<T> include(R value) {
        return (t) -> {
            Collection<R> collection = this.get(t);
            for (R v : collection) {
                if (v == null && value == null) return true;
                if (v != null && v.equals(value)) return true;
            }
            return false;
        };
    }

    default Predicate<T> exclude(R value) {
        return include(value).negate();
    }


}
